<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <title>版本管理 - {{.SITE_NAME}}</title>
    <link href="{{$.PathPrefix}}/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="{{$.PathPrefix}}/static/bootstrap-select-1.13.18/css/bootstrap-select.min.css" rel="stylesheet" />
    <link href="{{$.PathPrefix}}/static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link rel="shortcut icon" href="{{$.PathPrefix}}/favicon.ico" type="image/x-icon" />
    <link href="{{$.PathPrefix}}/static/css/main.css?version={{$.Version}}" rel="stylesheet">
    <script src="{{$.PathPrefix}}/static/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="{{$.PathPrefix}}/static/respond.js/1.4.2/respond.min.js"></script>
    <link rel="stylesheet" href="{{$.PathPrefix}}/static/css/toast.css">
</head>
<body>
<div class="manual-reader">
    {{template "widgets/header.html" .}}
    <div class="{{if $.IsWideScreen}}container-fluid container-widescreen{{else}}container{{end}} manual-body">
        <div class="row">
            <div class="page-left">
                {{template "manager/menu.html" .}}
            </div>
            <div class="page-right">
                <div class="m-box">
                    <div class="box-head">
                        <strong class="box-title">版本库管理</strong>
                        <a href="javascript:void(0);" class="pull-right btn btn-success" data-toggle="modal" data-target="#addVersion"><i class="fa fa-plus"></i> 新增版本库</a>
                    </div>
                </div>
                <br>
                <form class="bs-example bs-example-form" role="form">
                    <div class="input-group">
                        <input type="text" name="wd" value="{{.Wd}}" placeholder="search..." class="form-control">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="submit">搜索</button>
                        </span>
                    </div>
                </form>
                <div class="box-body" id="bookList">
                    <table class="table table-hover table-striped">
                        <thead>
                        <tr>
                            <th>名称</th>
                            <th>版本</th>
                            <th>时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                            {{range .Versions}}
                            <tr>
                                <td>
                                    <input type="text" class="form-control change-update" data-url="{{urlfor "ManagerController.UpdateVersion"}}?id={{.Id}}" name="title" value="{{.Title}}">
                                </td>
                                <td>
                                    {{if .Versions}}
                                    <div class="dropdown">
                                        <button type="button" class="btn dropdown-toggle" data-toggle="dropdown">版本 <span class="caret"></span></button>
                                        <ul class="dropdown-menu" role="menu">
                                            {{range .Versions}}
                                            <li role="presentation">
                                                <a role="menuitem" tabindex="-1" href="{{urlfor "DocumentController.ReadBook" ":key" .BookIdentify}}" target="_blank">{{.BookName}}</a>
                                            </li>
                                            {{end}}
                                        </ul>
                                    </div>
                                    {{else}}
                                    -
                                    {{end}}
                                </td>
                                <td>
                                    <div class="help-block">新建： {{date .CreatedAt "Y-m-d H:i:s"}}</div>
                                    <div class="help-block">更新： {{date .UpdatedAt "Y-m-d H:i:s"}}</div>
                                </td>
                                <td>
                                    <a href="{{urlfor "ManagerController.DeleteVersion"}}?id={{.Id}}" class="text-danger ajax-get confirm">删除</a>
                                </td>
                            </tr>
                           
                            {{end}}
                        </tbody>
                    </table>

                    <nav class="pagination-container">
                        {{.PageHtml}}
                    </nav>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="addVersion" tabindex="-1" role="dialog" aria-labelledby="addVersionLabel">
    <div class="modal-dialog" role="document">
        <form method="post" autocomplete="off" class="form-horizontal ajax-form" action="{{urlfor "ManagerController.AddVersions"}}">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">新增版本库</h4>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label class="col-sm-12">版本库名称<span class="error-message">*</span></label>
                    <div class="col-sm-12">
                        <textarea name="versions" rows="5" class="form-control" placeholder="请输入版本库名称，多个版本库，请换行输入"></textarea>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="modal-footer">
                <span id="form-error-message"></span>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="submit" class="btn btn-success" data-loading-text="保存中...">保存</button>
            </div>
        </div>
        </form>
    </div>
</div><!--END Modal-->

<script src="{{$.PathPrefix}}/static/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>
<script src="{{$.PathPrefix}}/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{$.PathPrefix}}/static/bootstrap-select-1.13.18/js/bootstrap-select.min.js"></script>
<script src="{{$.PathPrefix}}/static/js/toast.script.js"></script>
<script src="{{$.PathPrefix}}/static/js/main.js?version={{$.Version}}" type="text/javascript"></script>
</body>
</html>